import tkinter

class Query:
    def __init__(self,root):
        self.root = root
        self.root.geometry('600x500+100+100')
        self.root.title('信息小说下载')

        self.index_url = tkinter.StringVar()

        self.create_page()
        self.handle_event()

    def create_page(self):
        tkinter.Label(self.root,text='请输入小说名称：').place(x=30,y=30)
        tkinter.Entry(self.root,width=70,textvariable=self.index_url).place(x=30,y=60)
        tkinter.Label(self.root,text='保存路径：').place(x=30,y=90)
        tkinter.Entry(self.root).place(x=30,y=120)
        self.button1 = tkinter.Button(self.root,text='浏览',width=6,height=1)
        self.button1.place(x=200,y=120)
        self.button2 = tkinter.Button(self.root,text='下载',width=6,height=1)
        self.button2.place(x=350,y=120)
        self.button3 = tkinter.Button(self.root,text='清空',width=6,height=1)
        self.button3.place(x=450,y=120)

        self.text = tkinter.Text(self.root,width=82,height=22)
        self.text.place(x=30,y=160)

    def handle_event(self):
        self.button2['command'] = self.download_book

    def download_book(self):
        print(self.index_url.get())

if __name__ == '__main__':
    # 创建窗口
    root = tkinter.Tk()
    Query(root)
    # 事件循环
    root.mainloop()